<template>
  <div class="container">
    <div class="outDiv">
      <div class="setPassword" @click="handleIntoChangePwd">
        <div class="leftLabel">修改密码</div>
        <div class="rightIcon"></div>
      </div>
      <div class="exitLogin" @click="handleExitLoginStatus">退出登录</div>
    </div>
  </div>  
</template>

<script>
export default {
  data () {
    return {}
  },
  methods: {
    // 退出登录
    handleExitLoginStatus () {
      this.$httpWX.post({
        url: '/shengxueApi/identity/logout',
        header: {
          'content-type': 'application/json', // 默认值
          'Api-Version': '1.0.0',
          'accessToken': wx.getStorageSync('tokens')
        }
      }).then(res => {
        if (res.code === '0') {
          wx.showToast({
            title: res.message,
            icon: 'success',
            duration: 2000
          })
        } else {
          wx.showToast({
            title: '操作失败',
            icon: 'none'
          })
        }
      }).finally(() => {
        wx.clearStorage()
        wx.reLaunch({ url: '../index/main' })
      })
    },
    // 进入修改密码
    handleIntoChangePwd () {
      wx.navigateTo({ url: '../changePwdByCode/main' })
    }
  }
}
</script>

<style lang="less" scoped>
.outDiv {
  background: #FAFAFA;
  height: 100vh;
  .setPassword {
    width: 100%;
    height: 100rpx;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 49rpx 0 43rpx;
    box-sizing: border-box;
    margin-bottom: 33rpx;
    .leftLabel {
      color: #000;
      font-size: 28rpx;
      font-weight: bold;
    }
    .rightIcon {
      width: 36rpx;
      height: 36rpx;
      background: url('https://static.shengxue985.com/sxzx_miniprogram/teacher/css_sprites.png') -1170rpx -2011rpx;
      background-size: 746rpx 350rpx;
    }
  }
  .exitLogin {
    background: #fff;
    width: 100%;
    height: 100rpx;
    line-height: 100rpx;
    text-align: center;
    color: #FFAD0D;
    font-size: 28rpx;
    font-weight: bold;
  }
}
</style>
